package model

type Topic struct {
	Id int `form:"id" binding:"required"`
	Title string `binding:"required"`
}

func NewTopic(id int,title string) *Topic  {
	return &Topic{
		Id:id,
		Title:title,
	}
}

type TopicV struct {
	TopicId int `json:"id"`
	TopicTitle string `json:"title" binding:"min=4,max=20"`
	TopicShortTitle string `json:"stitle" binding:"required,nefield=TopicTitle"`
	UserIp string `json:"ip" binding:"ipv4"`
	TopicScore int `json:"score"  binding:"omitempty,gt=5"`
	TopicUrl string `json:"url"  binding:"omitempty,aaaa"`//aaaa 为自定验证
	//aaaa->main中的tag aaaa --> function
}


type Topics struct {
	Topics []TopicV `json:"topics" binding:"gt=0,lt=3,dive"`
	Size int
}
